import logging
import sys
import os

#just a comment line
#another comment to learn about stagin in git
LEVELS = {'debug': logging.DEBUG,
          'info': logging.INFO,
          'warning': logging.WARNING,
          'error': logging.ERROR,
          'critical': logging.CRITICAL}

if len(sys.argv) > 1:
    level_name = sys.argv[1]
    level = LEVELS.get(level_name, logging.NOTSET)
    logging.basicConfig(level=level)

#try and open a file
def openfile(file):
    
  cdir = os.getcwd()
  print cdir
  for file in os.listdir(cdir):
    print file
    #change to current directory
  filename="/home/satheesh/mydevelopment/python/example.py"
  print "using", os.name, "..."
  print "split", "=>", os.path.split(filename)
  print "splitext", "=>", os.path.splitext(filename)
  print "dirname", "=>", os.path.dirname(filename)
  print "basename", "=>", os.path.basename(filename)
  print "join", "=>", os.path.join(os.path.dirname(filename),
                                 os.path.basename(filename))

  #val = os.path.exists(os.path.dirname(filename))
  val = os.path.exists(filename)
  if os.path.exists(cdir):
    print "Path exists"
  else:
    #You make the directory
    os.makedir(cdir)
    print "Path does not exist, directory created"
    #os.chdir(cdir)

openfile("example.py")
